import "pkl:test"

class X {
  function sum(a: Int, b: Int): Int = a + b
  function sum2(a: Number, b: Number): Number = a + b
  function sum3(a: Int, b: Int): Int = 1.1 // wrong return type
}

local x = new X {}

res1 = x.sum(1, 2)
res2 = x.sum2(1, 2)
res3 = x.sum2(1.1, 2.2)
res4 = test.catch(() -> x.sum(1.1, 2))
res5 = test.catch(() -> x.sum2(1.1, "2"))
res6 = test.catch(() -> x.sum3(1, 1))
